Introduction:

This project focuses on developing regression models utilizing time series data from the Central Bank of the Republic of Turkey (CBRT) and Google Trends. Aim of the project is to fit time series regression models for selected economic measures including House Price Index, Money Supply, and Unemployment Rate by using time series data. In our regression model, the categories we mentioned, House Price Index, Money Supply, and Unemployment Rate, will serve as dependent variables whereas search terms from Google Trends will serve as independent variables. Time series regression models are built with monthly data from 2014 to 2024 from CBRT and Google Trends. Two important data sources are used in this study. The main source of economic statistics is the Central Bank of the Republic of Turkey (CBRT), which offers a wide range of indicators. As mentioned earlier, CBRT indicators are used as dependent variables in the project and Google Trends is used as the source of our independent variables. Google Trends platform provides information about online search behavior of people, making it possible to analyze search trends over time. In the first model we are constructing a time series regression model for the House Price Index, which is one of the major indicators for understanding the dynamics of the real estate market. In this model, the House Price Index serves as the dependent variable while search terms including "satılık ev" (houses for sale), "konut kredisi" (mortgage), and "faiz" (interest rates) from Google trends serve as predictor (independent) variables. The selection of these independent variables was justified by their possible impact on changes in the housing market. The word "satılık ev" (houses for sale) represents the amount of interest and demand present in the real estate market. Higher "satılık ev" search volumes suggest more people are interested in buying properties, which can raise housing prices. "Konut kredisi" (mortgage) is key component of financing home purchases, and the search volume of it may represent thenconsumer interest in mortgage loans. Variations in mortgage availability and interest rates have a direct impact on housing affordability, which in turn affects home prices. "Faiz" (interest rates) is a key factor in determining the dynamics of the housing market. Higher interest rates typically stifle the demand for mortgages, which lowers housing affordability and, as a result, drives down house prices. On the other hand, reduced interest rates increase demand and drive-up housing costs. In the second model we are constructing a time series regression model for Money Supply which is a crucial economic metric that indicates the total amount of money in use in a given economy. In this model, the Money Supply serves as the dependent variable while search terms including "faiz" (interest rates), “enflasyon” (inflation), “darphane” (mint), and “altın” (gold) from Google trends serve as predictor (independent) variables. The rationale behind the selection of independent variables from Google Trends is their capacity to have significant influence on the dynamics of Money Supply. The "faiz" (interest rates) have a major impact on the dynamics of the money supply and monetary policy. Interest rate fluctuations can have an effect on lending and borrowing practices, which can change the amount of money in the economy overall. The term "enflasyon" (inflation) is a crucial economic indicator that policy-makers actively watch. Variations in inflation rates have the potential to impact investment choices, consumer spending habits, and ultimately the dynamics of the money supply. Public interest in minting activities is reflected in the phrase "darphane" (mint), which may be a sign of shifts in the demand for currency or government intervention in the money supply. As a safe-haven asset and store of wealth, "altın" (gold) is very important in the world economy. Changes in investor attitude and confidence could be reflected in fluctuations in gold prices, which could influence the dynamics of the money supply. In our third and final model, we are constructing a time series regression model for Unemployment Rate, a crucial economic indicator that represents the percentage of the labor force that is unemployed and actively looking for work. In this model, the Unemployment Rate serves as the dependent variable while search terms including "iş ilanları" (job advertisement), "enflasyon" (inflation), "salgın hastalık" (epidemic disease), "işsizlik sigortası" (unemployment insurance), and "işsizlik" (unemployment) from Google trends serve as predictor (independent) variables. These carefully selected Google Trends search phrases provide insightful information about a range of variables affecting the dynamics of unemployment. The public's interest in job advertisements, which might offer insights into employment opportunities and labor market dynamics, is reflected in the search term "iş ilanları". Inflationary pressures known as "enflasyon" can affect corporate expenses and consumer purchasing power, which can therefore effect hiring decisions and unemployment rates. The occurrence of "salgın hastalık" (epidemic diseases), like the COVID-19 pandemic, may have a significant impact on labor markets, resulting in job losses, interruptions to the economy, and adjustments to employment patterns. Concerns about job security and the possibility of unemployment may be the source of interest in "işsizlik sigortası" (unemployment insurance), which can reveal attitudes toward the labor market. The public's interest in unemployment concerns is directly captured by searches pertaining to "işsizlik" (unemployment), which reflects underlying patterns and sentiment regarding labor market situations. Finally, to evaluate the effectiveness of the model, a number of statistical tests (Breusch Godfrey etc.) and metrics (R square, corresponding p-values of coefficients of independent variables) were used. These included tests for autocorrelation, examination of the model's goodness of fit, and analysis of residuals. The objective of closely examining these elements was to ensure the reliability and resilience of the time series regression models we have developed for the Money Supply, Unemployment Rate, and House Price Index.

First, we start by showing the required libraries that we will use in our code.

In [1]:
require(data.table)
require(lubridate)
require(forecast)
require(skimr)
require(repr)
require(readxl)
require(ggplot2)
Zorunlu paket yükleniyor: data.table

Zorunlu paket yükleniyor: lubridate


Attaching package: ‘lubridate’


The following objects are masked from ‘package:data.table’:

    hour, isoweek, mday, minute, month, quarter, second, wday, week,
    yday, year


The following objects are masked from ‘package:base’:

    date, intersect, setdiff, union


Zorunlu paket yükleniyor: forecast

Registered S3 method overwritten by 'quantmod':
  method            from
  as.zoo.data.frame zoo 

Zorunlu paket yükleniyor: skimr

Zorunlu paket yükleniyor: repr

Zorunlu paket yükleniyor: readxl

Zorunlu paket yükleniyor: ggplot2

In this part, I have downloaded house index, money supply, and unemployment rate data from TCMB as xlsx file and manipulated those data such that all shows the data between 01.01.2014 - 01.01.2024. Besides, I have created time series objects for each data in order to use them in forecasting. All three sets of data provided below will be our dependent variables, which we will be trying to create the models of them.

In [2]:
house_index_data <- read_excel("Desktop/360R/house_price_index.xlsx")
house_index_data <- house_index_data[31:152, ]
house_index_data <- house_index_data[,-3]
colnames(house_index_data) <- c("Date", "House Price Index")
house_index_data$Date <- as.Date(paste(house_index_data$Date, "-01", sep = ""))
house_index_data$"House Price Index" <- as.numeric(house_index_data$"House Price Index")
initial_time <- c(year(min(house_index_data$Date)), month(min(house_index_data$Date)))
house_index_ts <- ts(house_index_data$"House Price Index", start = initial_time, frequency = 12)
house_index_ts
New names:
• `` -> `...3`
A Time Series: 11 × 12
JanFebMarAprMayJunJulAugSepOctNovDec
2014 64.1 64.8 65.7 66.8 67.5 68.2 69.3 70.2 70.9 71.5 72.4 73.1
2015 74.2 75.4 76.6 77.7 78.9 79.9 80.6 81.1 81.7 82.7 83.7 84.5
2016 85.7 86.6 87.5 88.6 89.7 90.5 91.3 92.3 92.8 93.5 94.0 94.8
2017 95.5 96.7 97.9 98.7 99.8 100.3 100.5 100.8 101.4 102.2 102.8 103.4
2018 104.1 104.8 105.7 107.1 108.6 109.1 109.3 108.7 107.8 108.5 109.2 108.0
2019 107.6 108.6 109.0 109.3 110.2 111.0 112.4 114.4 115.2 116.0 117.1 118.8
2020 120.9 123.7 125.4 127.5 135.9 139.5 141.4 144.4 146.7 149.9 152.2 154.9
2021 157.7 161.7 165.5 168.8 175.4 180.3 185.4 192.7 198.9 210.2 229.2 247.4
2022 279.9 318.0 347.7 383.0 431.1 470.0 507.8 548.2 575.0 605.8 629.2 662.7
2023 708.5 768.1 809.6 847.4 878.0 921.0 988.71043.11087.91129.51150.01163.3
20241190.01213.0
In [3]:
M1_data <- read_excel("Desktop/360R/M1.xlsx")
M1_data <- M1_data[29:150, ]
M1_data <- M1_data[,-3]
colnames(M1_data) <- c("Date", "M1")
M1_data$Date <- as.Date(paste(M1_data$Date, "-01", sep = ""))
M1_data$"M1" <- as.numeric(M1_data$"M1")
initial_time <- c(year(min(M1_data$Date)), month(min(M1_data$Date)))
M1_ts <- ts(M1_data$"M1", start = initial_time, frequency = 12)
M1_ts
New names:
• `` -> `...3`
A Time Series: 11 × 12
JanFebMarAprMayJunJulAugSepOctNovDec
2014 222778962 221554826 229538298 225530537 224382058 238150238 247677613 241878967 249785641 247424552 245494451 251991723
2015 251419161 256672749 261935572 273990507 280246416 285907662 294157799 302536632 322378630 308090197 307160179 312005973
2016 307780794 312767158 315704986 322480264 325211114 336562968 344856750 343756071 347747515 348794511 359751417 382351496
2017 376732225 377212027 401173247 419127390 411475365 421573145 419416200 433232693 434181238 429971761 437243382 449631796
2018 428232624 433707515 451583613 463082040 496312574 513594608 509485823 588067823 559184535 523005315 488062659 512524057
2019 505911428 517326639 569489652 567678259 612272035 608264637 602826683 641486805 655504373 666800207 677077915 712832597
2020 736761246 787440698 847047260100418056410490038901101587027119546371912121716231230939243127499275312560461331219863695
2021119683643311745175791221726118127448035913397136441375019253141402572914138019381461023866156652967018731670652097220269
2022211786406921844272312307772436238205302125391995852662097003273990712127754764042857946610295058965829873908333131103033
2023317375716632500315413469728070367231906235232423424180536954439012924345457529254492359898456579090846314621464757514054
202448372215175049627766
In [4]:
unemployment_rate_data <- read_excel("Desktop/360R/unemployment_rate.xlsx")
unemployment_rate_data <- unemployment_rate_data[1:122, ]
unemployment_rate_data <- unemployment_rate_data[,-3]
colnames(unemployment_rate_data) <- c("Date", "Rate")
unemployment_rate_data$Date <- as.Date(paste(unemployment_rate_data$Date, "-01", sep = ""))
unemployment_rate_data$"Rate" <- as.numeric(unemployment_rate_data$"Rate")
initial_time <- c(year(min(unemployment_rate_data$Date)), month(min(unemployment_rate_data$Date)))
unemployment_rate_ts <- ts(unemployment_rate_data$"Rate", start = initial_time, frequency = 12)
unemployment_rate_ts
New names:
• `` -> `...3`
A Time Series: 11 × 12
JanFebMarAprMayJunJulAugSepOctNovDec
201410.510.5 9.4 8.8 8.4 9.0 9.710.110.110.910.410.8
201511.911.710.4 9.6 8.9 9.610.010.010.310.510.210.9
201611.511.010.1 9.1 9.010.111.011.011.811.911.612.8
201713.512.911.710.5 9.710.410.610.610.410.510.010.3
201811.010.8 9.8 9.3 9.410.210.711.111.411.712.013.3
201915.115.013.912.912.513.414.114.214.013.312.913.6
202014.113.513.012.812.613.014.613.012.412.812.913.0
202113.414.113.112.912.410.412.112.011.110.710.911.3
202212.111.411.410.610.1 9.710.6 9.8 9.9 9.9 9.910.4
202310.310.710.210.0 8.8 9.0 9.7 9.2 8.9 8.2 8.8 8.9
2024 9.8 9.7

Needed data manipulation for independent variables:

I have already downloaded different google trend data in order to use in our model as independent variables as I discussed in introduction section. In this part of the code, I have fetched data from csv files of each data set which I will be using in my models. Then I have manipulated data in time restriction which I have also done to dependent variables. Then I have created time series objects for each of the 10 independent variables. Then I have plotted them to observe their patterns and behaviours.

In [5]:
satılık_ev_data = fread("Desktop/360R/satılık_ev.csv")
colnames(satılık_ev_data) <- c("Date", "Amount")
satılık_ev_data$Date <- as.Date(paste(satılık_ev_data$Date, "-01", sep = ""))
satılık_ev_data <- satılık_ev_data[satılık_ev_data$Date >= as.Date("2014-01-01") & satılık_ev_data$Date <= as.Date("2024-02-01")]
initial_time <- c(year(min(satılık_ev_data$Date)), month(min(satılık_ev_data$Date)))
satılık_ev_ts <- ts(satılık_ev_data$Amount, start = initial_time, frequency = 12)

konut_kredisi_data = fread("Desktop/360R/konut_kredisi.csv")
colnames(konut_kredisi_data) <- c("Date", "Amount")
konut_kredisi_data$Date <- as.Date(paste(konut_kredisi_data$Date, "-01", sep = ""))
konut_kredisi_data <- konut_kredisi_data[konut_kredisi_data$Date >= as.Date("2014-01-01") & konut_kredisi_data$Date <= as.Date("2024-02-01")]
initial_time <- c(year(min(konut_kredisi_data$Date)), month(min(konut_kredisi_data$Date)))
konut_kredisi_ts <- ts(konut_kredisi_data$Amount, start = initial_time, frequency = 12)

faiz_data = fread("Desktop/360R/faiz.csv")
colnames(faiz_data) <- c("Date", "Amount")
faiz_data$Date <- as.Date(paste(faiz_data$Date, "-01", sep = ""))
faiz_data <- faiz_data[faiz_data$Date >= as.Date("2014-01-01") & faiz_data$Date <= as.Date("2024-02-01")]
initial_time <- c(year(min(faiz_data$Date)), month(min(faiz_data$Date)))
faiz_ts <- ts(faiz_data$"Amount", start = initial_time, frequency = 12)

enflasyon_data = fread("Desktop/360R/enflasyon.csv")
colnames(enflasyon_data) <- c("Date", "Amount")
enflasyon_data$Date <- as.Date(paste(enflasyon_data$Date, "-01", sep = ""))
enflasyon_data <- enflasyon_data[enflasyon_data$Date >= as.Date("2014-01-01") & enflasyon_data$Date <= as.Date("2024-02-01")]
initial_time <- c(year(min(enflasyon_data$Date)), month(min(enflasyon_data$Date)))
enflasyon_ts <- ts(enflasyon_data$Amount, start = initial_time, frequency = 12)

darphane_data = fread("Desktop/360R/darphane.csv")
colnames(darphane_data) <- c("Date", "Amount")
darphane_data$Date <- as.Date(paste(darphane_data$Date, "-01", sep = ""))
darphane_data <- darphane_data[darphane_data$Date >= as.Date("2014-01-01") & darphane_data$Date <= as.Date("2024-02-01")]
initial_time <- c(year(min(darphane_data$Date)), month(min(darphane_data$Date)))
darphane_ts <- ts(darphane_data$Amount, start = initial_time, frequency = 12)

altın_data = fread("Desktop/360R/altın.csv")
colnames(altın_data) <- c("Date", "Amount")
altın_data$Date <- as.Date(paste(altın_data$Date, "-01", sep = ""))
altın_data <- altın_data[altın_data$Date >= as.Date("2014-01-01") & altın_data$Date <= as.Date("2024-02-01")]
initial_time <- c(year(min(altın_data$Date)), month(min(altın_data$Date)))
altın_ts <- ts(altın_data$Amount, start = initial_time, frequency = 12)

salgın_hastalık_data = fread("Desktop/360R/salgın_hastalık.csv")
colnames(salgın_hastalık_data) <- c("Date", "Amount")
salgın_hastalık_data$Date <- as.Date(paste(salgın_hastalık_data$Date, "-01", sep = ""))
salgın_hastalık_data <- salgın_hastalık_data[salgın_hastalık_data$Date >= as.Date("2014-01-01") & salgın_hastalık_data$Date <= as.Date("2024-02-01")]
initial_time <- c(year(min(salgın_hastalık_data$Date)), month(min(salgın_hastalık_data$Date)))
salgın_hastalık_ts <- ts(salgın_hastalık_data$Amount, start = initial_time, frequency = 12)

işsizlik_sigortası_data = fread("Desktop/360R/işsizlik_sigortası.csv")
colnames(işsizlik_sigortası_data) <- c("Date", "Amount")
işsizlik_sigortası_data$Date <- as.Date(paste(işsizlik_sigortası_data$Date, "-01", sep = ""))
işsizlik_sigortası_data <- işsizlik_sigortası_data[işsizlik_sigortası_data$Date >= as.Date("2014-01-01") & işsizlik_sigortası_data$Date <= as.Date("2024-02-01")]
initial_time <- c(year(min(işsizlik_sigortası_data$Date)), month(min(işsizlik_sigortası_data$Date)))
işsizlik_sigortası_ts <- ts(işsizlik_sigortası_data$Amount, start = initial_time, frequency = 12)

iş_ilanları_data = fread("Desktop/360R/iş_ilanları.csv")
colnames(iş_ilanları_data) <- c("Date", "Amount")
iş_ilanları_data$Date <- as.Date(paste(iş_ilanları_data$Date, "-01", sep = ""))
iş_ilanları_data <- iş_ilanları_data[iş_ilanları_data$Date >= as.Date("2014-01-01") & iş_ilanları_data$Date <= as.Date("2024-02-01")]
initial_time <- c(year(min(iş_ilanları_data$Date)), month(min(iş_ilanları_data$Date)))
iş_ilanları_ts <- ts(iş_ilanları_data$Amount, start = initial_time, frequency = 12)

işsizlik_data = fread("Desktop/360R/işsizlik.csv")
colnames(işsizlik_data) <- c("Date", "Amount")
işsizlik_data$Date <- as.Date(paste(işsizlik_data$Date, "-01", sep = ""))
işsizlik_data <- işsizlik_data[işsizlik_data$Date >= as.Date("2014-01-01") & işsizlik_data$Date <= as.Date("2024-02-01")]
initial_time <- c(year(min(işsizlik_data$Date)), month(min(işsizlik_data$Date)))
işsizlik_ts <- ts(işsizlik_data$Amount, start = initial_time, frequency = 12)

autoplot(satılık_ev_ts)
autoplot(konut_kredisi_ts)
autoplot(faiz_ts)
autoplot(enflasyon_ts)
autoplot(darphane_ts)
autoplot(altın_ts)
autoplot(salgın_hastalık_ts)
autoplot(işsizlik_sigortası_ts)
autoplot(iş_ilanları_ts)
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'satılık_ev_ts' in 'mbcsToSbcs': dot substituted for <c4>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'satılık_ev_ts' in 'mbcsToSbcs': dot substituted for <b1>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'satılık_ev_ts' in 'mbcsToSbcs': dot substituted for <c4>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'satılık_ev_ts' in 'mbcsToSbcs': dot substituted for <b1>”
Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'satılık_ev_ts' in 'mbcsToSbcs': dot substituted for <c4>”
Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'satılık_ev_ts' in 'mbcsToSbcs': dot substituted for <b1>”
Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'satılık_ev_ts' in 'mbcsToSbcs': dot substituted for <c4>”
Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'satılık_ev_ts' in 'mbcsToSbcs': dot substituted for <b1>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'altın_ts' in 'mbcsToSbcs': dot substituted for <c4>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'altın_ts' in 'mbcsToSbcs': dot substituted for <b1>”
Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'altın_ts' in 'mbcsToSbcs': dot substituted for <c4>”
Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'altın_ts' in 'mbcsToSbcs': dot substituted for <b1>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'salgın_hastalık_ts' in 'mbcsToSbcs': dot substituted for <c4>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'salgın_hastalık_ts' in 'mbcsToSbcs': dot substituted for <b1>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'salgın_hastalık_ts' in 'mbcsToSbcs': dot substituted for <c4>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'salgın_hastalık_ts' in 'mbcsToSbcs': dot substituted for <b1>”
Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'salgın_hastalık_ts' in 'mbcsToSbcs': dot substituted for <c4>”
Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'salgın_hastalık_ts' in 'mbcsToSbcs': dot substituted for <b1>”
Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'salgın_hastalık_ts' in 'mbcsToSbcs': dot substituted for <c4>”
Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'salgın_hastalık_ts' in 'mbcsToSbcs': dot substituted for <b1>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'işsizlik_sigortası_ts' in 'mbcsToSbcs': dot substituted for <c5>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'işsizlik_sigortası_ts' in 'mbcsToSbcs': dot substituted for <9f>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'işsizlik_sigortası_ts' in 'mbcsToSbcs': dot substituted for <c4>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'işsizlik_sigortası_ts' in 'mbcsToSbcs': dot substituted for <b1>”
Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'işsizlik_sigortası_ts' in 'mbcsToSbcs': dot substituted for <c5>”
Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'işsizlik_sigortası_ts' in 'mbcsToSbcs': dot substituted for <9f>”
Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'işsizlik_sigortası_ts' in 'mbcsToSbcs': dot substituted for <c4>”
Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'işsizlik_sigortası_ts' in 'mbcsToSbcs': dot substituted for <b1>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'iş_ilanları_ts' in 'mbcsToSbcs': dot substituted for <c5>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'iş_ilanları_ts' in 'mbcsToSbcs': dot substituted for <9f>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'iş_ilanları_ts' in 'mbcsToSbcs': dot substituted for <c4>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'iş_ilanları_ts' in 'mbcsToSbcs': dot substituted for <b1>”
Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'iş_ilanları_ts' in 'mbcsToSbcs': dot substituted for <c5>”
Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'iş_ilanları_ts' in 'mbcsToSbcs': dot substituted for <9f>”
Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'iş_ilanları_ts' in 'mbcsToSbcs': dot substituted for <c4>”
Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'iş_ilanları_ts' in 'mbcsToSbcs': dot substituted for <b1>”

House Price Index Model:

First, I will be trying to model House Price Index time series. Plotting data is important for seeing important patterns and behaviours of the time series.

In [6]:
autoplot(house_index_ts) + ggtitle("House Price Index vs Time") + xlab("Year") + ylab("House Price Index")

Then I check the autocorrelation function of house price index time series. It can be seen that there is a high positive autocorelation for small lag values, which is even close to 1. It can be understood that our model should be an autoregressive model, where we should be using differencing methods in order to make our data stationary. However our aim in our homework is to find independent variables, we will not be working on it, but will neglect the effects of this behaviour at the end, for the residuals that we obtain.

In [7]:
ggAcf(house_index_ts, lag.max = 120)
ggAcf(house_index_ts)

I have created a dataframe in order to create rows, which I will be using in plotting.

In [8]:
df_house_index <- cbind(house_index_data[,-1], satılık_ev_data$Amount, konut_kredisi_data$Amount, faiz_data$Amount)
df_house_index
A data.frame: 122 × 4
House Price Indexsatılık_ev_data$Amountkonut_kredisi_data$Amountfaiz_data$Amount
<dbl><int><int><int>
64.123 919
64.823 919
65.721 715
66.821 817
67.522 816
68.222 816
69.322 915
70.2261015
70.9241015
71.524 813
72.425 815
73.122 816
74.223 917
75.4291119
76.6291017
77.727 815
78.925 813
79.924 814
80.629 713
81.131 915
81.726 816
82.725 714
83.7271121
84.527 922
85.727 817
86.631 918
87.533 921
88.6331223
89.7321021
90.5291019
⋮⋮⋮⋮
198.94515 54
210.24321 58
229.24521 75
247.44720 80
279.94616 58
318.04616 47
347.74916 57
383.04815 46
431.15544 70
470.05021 58
507.85016 57
548.24714 52
575.04015 57
605.83512 51
629.23211 54
662.73513 50
708.54757 62
768.15317 46
809.64316 56
847.43814 51
878.03414 54
921.03714100
988.74417 88
1043.14117 76
1087.93517 96
1129.53014 83
1150.02711 81
1163.32810 94
1190.02912 73
1213.02613 65

To obtain correlation matrix of our independent variables and dependent variable.

In [9]:
require(GGally)
ggpairs(df_house_index)
Zorunlu paket yükleniyor: GGally

Registered S3 method overwritten by 'GGally':
  method from   
  +.gg   ggplot2

Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'satılık_ev_data$Amount' in 'mbcsToSbcs': dot substituted for <c4>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'satılık_ev_data$Amount' in 'mbcsToSbcs': dot substituted for <b1>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'satılık_ev_data$Amount' in 'mbcsToSbcs': dot substituted for <c4>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'satılık_ev_data$Amount' in 'mbcsToSbcs': dot substituted for <b1>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'satılık_ev_data$Amount' in 'mbcsToSbcs': dot substituted for <c4>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'satılık_ev_data$Amount' in 'mbcsToSbcs': dot substituted for <b1>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'satılık_ev_data$Amount' in 'mbcsToSbcs': dot substituted for <c4>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'satılık_ev_data$Amount' in 'mbcsToSbcs': dot substituted for <b1>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'satılık_ev_data$Amount' in 'mbcsToSbcs': dot substituted for <c4>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'satılık_ev_data$Amount' in 'mbcsToSbcs': dot substituted for <b1>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'satılık_ev_data$Amount' in 'mbcsToSbcs': dot substituted for <c4>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'satılık_ev_data$Amount' in 'mbcsToSbcs': dot substituted for <b1>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'satılık_ev_data$Amount' in 'mbcsToSbcs': dot substituted for <c4>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'satılık_ev_data$Amount' in 'mbcsToSbcs': dot substituted for <b1>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'satılık_ev_data$Amount' in 'mbcsToSbcs': dot substituted for <c4>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'satılık_ev_data$Amount' in 'mbcsToSbcs': dot substituted for <b1>”
Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'satılık_ev_data$Amount' in 'mbcsToSbcs': dot substituted for <c4>”
Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'satılık_ev_data$Amount' in 'mbcsToSbcs': dot substituted for <b1>”
Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'satılık_ev_data$Amount' in 'mbcsToSbcs': dot substituted for <c4>”
Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'satılık_ev_data$Amount' in 'mbcsToSbcs': dot substituted for <b1>”
Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'satılık_ev_data$Amount' in 'mbcsToSbcs': dot substituted for <c4>”
Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'satılık_ev_data$Amount' in 'mbcsToSbcs': dot substituted for <b1>”
Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'satılık_ev_data$Amount' in 'mbcsToSbcs': dot substituted for <c4>”
Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'satılık_ev_data$Amount' in 'mbcsToSbcs': dot substituted for <b1>”

It can be observed that there is a high correlation between House Price Index and Faiz dataset, which is 0.670. To see different models, we will be creating models with different combinations of our independet variables and get the summary of them.

In [10]:
tslm_house_index_1 <- tslm(house_index_ts ~ satılık_ev_ts + konut_kredisi_ts + faiz_ts)
tslm_house_index_2 <- tslm(house_index_ts ~ konut_kredisi_ts + faiz_ts)
tslm_house_index_3 <- tslm(house_index_ts ~ faiz_ts)

summary(tslm_house_index_1)
summary(tslm_house_index_2)
summary(tslm_house_index_3)
Call:
tslm(formula = house_index_ts ~ satılık_ev_ts + konut_kredisi_ts + 
    faiz_ts)

Residuals:
    Min      1Q  Median      3Q     Max 
-564.78 -110.08   10.81   49.84  675.45 

Coefficients:
                 Estimate Std. Error t value Pr(>|t|)    
(Intercept)      -96.4869    67.6589  -1.426    0.156    
satılık_ev_ts      1.4166     2.1740   0.652    0.516    
konut_kredisi_ts  -8.8782     2.1122  -4.203 5.14e-05 ***
faiz_ts           10.9634     0.9442  11.612  < 2e-16 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 206.2 on 118 degrees of freedom
Multiple R-squared:  0.5401,	Adjusted R-squared:  0.5284 
F-statistic: 46.19 on 3 and 118 DF,  p-value: < 2.2e-16
Call:
tslm(formula = house_index_ts ~ konut_kredisi_ts + faiz_ts)

Residuals:
    Min      1Q  Median      3Q     Max 
-578.20 -109.87   10.74   47.25  662.13 

Coefficients:
                 Estimate Std. Error t value Pr(>|t|)    
(Intercept)      -61.5598    41.1878  -1.495    0.138    
konut_kredisi_ts  -8.0424     1.6741  -4.804 4.58e-06 ***
faiz_ts           11.0305     0.9363  11.781  < 2e-16 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 205.7 on 119 degrees of freedom
Multiple R-squared:  0.5384,	Adjusted R-squared:  0.5307 
F-statistic:  69.4 on 2 and 119 DF,  p-value: < 2.2e-16
Call:
tslm(formula = house_index_ts ~ faiz_ts)

Residuals:
    Min      1Q  Median      3Q     Max 
-558.21 -127.84   14.37   57.71  739.54 

Coefficients:
             Estimate Std. Error t value Pr(>|t|)    
(Intercept) -122.5224    42.6369  -2.874   0.0048 ** 
faiz_ts        9.1690     0.9274   9.887   <2e-16 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 223.8 on 120 degrees of freedom
Multiple R-squared:  0.4489,	Adjusted R-squared:  0.4443 
F-statistic: 97.74 on 1 and 120 DF,  p-value: < 2.2e-16

It can be seen that there is a high p value for satılık_ev coefficient, which results in the hypothesis that the we fail to reject that the corresponding coefficient is zero. Thus, I have also examined another models by subtracting satılık_ev data set. It can be seen that in second model, I obtained 0.5284 adjusted R squared value which indicates that how much of the variability in actual data can be explained by our model. 0.5284 might not be an indicator of a good model however, since I didn't apply any differencing method nor dummy variable, this value is good enough since our data is not even stationary.

Code below provides different metrics of our models. Akaike and Bayesian information criterion are metrics for penalized regression, where high amount of parameter coefficient and data amount are considered to be penalized. It can also be seen that my second model yeilds better result from all metrics.

In [11]:
CV_data <- data.frame(rbind(CV(tslm_house_index_1), CV(tslm_house_index_2), CV(tslm_house_index_3)))
CV_data
A data.frame: 3 × 5
CVAICAICcBICAdjR2
<dbl><dbl><dbl><dbl><dbl>
46913.561306.1351306.6521320.1550.5283751
46204.491304.5731304.9151315.7890.5306556
51667.921324.1991324.4021332.6110.4443005

To see the actual data and model result, I have plotted both to single graph. By eliminating outliers and stationarity, this model would have been improved.

In [12]:
autoplot(house_index_ts, series = "Actual Data") + 
  autolayer(fitted(tslm_house_index_2), series = "Model Result")

Then we check residuals for all three models by looking at their autocorrelation functions, residual distribution functions, and residual time series. It can be seen that there exists high positive autocorrelation for small lag numbers which I have expected to see at the beginning due to not applying differencing method since our dependent varaible data set was not stationary. However, the residual distribution graph does not seems to close to normal, which indicates that there is mode information and heterodasticity that is leftover, and that should be explained in our model. It can be seen that the Breusch-Godfrey test results have small p values, which are close to 0. Since Breush-Godfrey test has hypothesis 0 that there is not autocorrelation between residuals and the heterodasticity is low, and I obtained small p values, it concludes to reject that my resualds are not autocorrelated so the model does not perfectly describes the actual data.

In [13]:
checkresiduals(tslm_house_index_1)
checkresiduals(tslm_house_index_2)
checkresiduals(tslm_house_index_3)
	Breusch-Godfrey test for serial correlation of order up to 24

data:  Residuals from Linear regression model
LM test = 97.864, df = 24, p-value = 6.935e-11
	Breusch-Godfrey test for serial correlation of order up to 24

data:  Residuals from Linear regression model
LM test = 97.904, df = 24, p-value = 6.826e-11
	Breusch-Godfrey test for serial correlation of order up to 24

data:  Residuals from Linear regression model
LM test = 105.46, df = 24, p-value = 3.47e-12

By drawing residuals vs fitted values data, it is importnat to observe the distribution of residuals. If residuals were likely to be normally distributed with mean zero and sigma squared, they should have scattered arround randomly, which would have indicated white noise series. However our residuals did not scattered randomly, which is not good to obtain as a result.

In [14]:
df_house_index[,"Residuals"] <- as.numeric(residuals(tslm_house_index_2))
ggplot(df_house_index, aes(x = fitted(tslm_house_index_2), y = Residuals)) + geom_point()
Don't know how to automatically pick scale for object of type <ts>. Defaulting
to continuous.

Money Supply Model:

In this section, I will be proceeding with Money Supply Model. Since I have explained the code in previous model, I will not be explaining it, just commanding on results in further models.

In [15]:
autoplot(M1_ts) + ggtitle("Money Supply vs Time") + xlab("Year") + ylab("Money Supply")

It can be observed that there is exists high autocorrelation for small amount of lags. Since there exists a regular downward trend in autocorrelation function, it should be thought that our model should be either autoregressive or we should be working with differenced data set.

In [16]:
ggAcf(M1_ts, lag.max = 120)
ggAcf(M1_ts)

From the autocorrelation function provided below, it can be seen that there have been significant amount of decreament in autocorrelation values for different lags when I applied 1 month differencing. By applying higher order differencing and box-cox transformation, this autocorrelation function would be fitted into the blue lines, two divided by root n, since the high autocorrelation was getting caused by non-stationary data. However I will be continuing with the non-differneced data since when I have checked the correlations between independent data set and lagged data set, I have obtained worse result since some independet data set also requires differencing and other needs since they are not also stationary. So I will be proceeding with non-stationary Money Supply 1 data set.

In [17]:
require(zoo)
M1_lag1dif <- diff(zoo(M1_data$M1),lag=1,differences = 1,na.pad = TRUE)
M1_lag1dif_ts <- ts(M1_lag1dif, frequency = 12)

ggAcf(M1_lag1dif_ts, lag.max = 120)
ggAcf(M1_lag1dif_ts)
Zorunlu paket yükleniyor: zoo


Attaching package: ‘zoo’


The following objects are masked from ‘package:data.table’:

    yearmon, yearqtr


The following objects are masked from ‘package:base’:

    as.Date, as.Date.numeric


In [18]:
df_M1 <- cbind(M1_data[,-1], faiz_data$Amount, enflasyon_data$Amount, darphane_data$Amount, altın_data$Amount)
df_M1
A data.frame: 122 × 5
M1faiz_data$Amountenflasyon_data$Amountdarphane_data$Amountaltın_data$Amount
<dbl><int><int><int><int>
22277896219 9 712
22155482619 5 810
22953829815 4 7 9
22553053717 5 9 8
22438205816 5 9 7
23815023816 5 9 8
24767761315 510 7
24187896715 3 9 7
24978564115 310 7
24742455213 411 6
24549445115 410 9
25199172316 5 8 8
25141916117 9 910
25667274919 6 910
26193557217 610 8
27399050715 5 9 8
28024641613 7 7 6
28590766214 9 6 7
29415779913 7 7 8
30253663215 4 610
32237863016 4 6 7
30809019714 4 7 6
30716017921 611 9
31200597322 9 8 7
3077807941713 6 7
31276715818 5 910
31570498621 5 8 8
32248026423 5 7 7
32521111421 5 7 9
33656296819 5 6 8
⋮⋮⋮⋮⋮
1461023866 5417 16 25
1566529670 5825 14 38
1873167065 7538 19 65
2097220269 8056 19100
2117864069 5866 21 44
2184427231 4738 21 47
2307772436 5742 23 50
2382053021 4653 16 31
2539199585 7076 14 45
2662097003 5874 15 52
2739907121 5758 16 42
2775476404 5236 18 39
2857946610 5740 16 39
2950589658 5140 14 35
2987390833 5442 49 36
3131103033 5054 37 34
3173757166 6241 36 42
3250031541 4624 30 30
3469728070 5624 28 42
3672319062 5126 28 40
3523242342 5426 38 49
418053695410035 46 56
4390129243 8847 29 48
4545752925 7627 36 38
4492359898 9635 28 32
4565790908 8329100 40
4631462146 8138 65 34
4757514054 9445 49 35
4837221517 7343 35 29
5049627766 6530 33 26
In [19]:
require(GGally)
ggpairs(df_M1)
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'altın_data$Amount' in 'mbcsToSbcs': dot substituted for <c4>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'altın_data$Amount' in 'mbcsToSbcs': dot substituted for <b1>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'altın_data$Amount' in 'mbcsToSbcs': dot substituted for <c4>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'altın_data$Amount' in 'mbcsToSbcs': dot substituted for <b1>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'altın_data$Amount' in 'mbcsToSbcs': dot substituted for <c4>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'altın_data$Amount' in 'mbcsToSbcs': dot substituted for <b1>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'altın_data$Amount' in 'mbcsToSbcs': dot substituted for <c4>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'altın_data$Amount' in 'mbcsToSbcs': dot substituted for <b1>”
Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'altın_data$Amount' in 'mbcsToSbcs': dot substituted for <c4>”
Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'altın_data$Amount' in 'mbcsToSbcs': dot substituted for <b1>”
Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'altın_data$Amount' in 'mbcsToSbcs': dot substituted for <c4>”
Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'altın_data$Amount' in 'mbcsToSbcs': dot substituted for <b1>”

It can be seen that there is a high correlation between Google trends data of faiz, enflasyon, darphane, altın; and M1. It can also be seen that there also exists high correlation between independent variables which is the result of multicollinearty. Even there does not exist perfect multicollinearty, the variability will not be perfectly explained by different independent variables and the R squared value will be higher than expected. This might be caused by high inflation makes most of the data non-stationary by adding trend component to them. Thus, there might be existing high correlation caused by increasing trend in all data sets.

In [20]:
tslm_M1_1 <- tslm(M1_ts ~ faiz_ts + enflasyon_ts + darphane_ts + altın_ts)
tslm_M1_2 <- tslm(M1_ts ~ faiz_ts + enflasyon_ts + darphane_ts)
tslm_M1_3 <- tslm(M1_ts ~ enflasyon_ts + darphane_ts)
summary(tslm_M1_1)
summary(tslm_M1_2)
summary(tslm_M1_3)
Call:
tslm(formula = M1_ts ~ faiz_ts + enflasyon_ts + darphane_ts + 
    altın_ts)

Residuals:
       Min         1Q     Median         3Q        Max 
-2.101e+09 -3.856e+08  6.162e+07  1.962e+08  2.554e+09 

Coefficients:
               Estimate Std. Error t value Pr(>|t|)    
(Intercept)  -613195874  127466409  -4.811 4.53e-06 ***
faiz_ts        11854213    4671710   2.537   0.0125 *  
enflasyon_ts   23299524    5698982   4.088 8.00e-05 ***
darphane_ts    43165538    5579745   7.736 3.98e-12 ***
altın_ts        8265582    6046416   1.367   0.1742    
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 662400000 on 117 degrees of freedom
Multiple R-squared:   0.75,	Adjusted R-squared:  0.7414 
F-statistic: 87.74 on 4 and 117 DF,  p-value: < 2.2e-16
Call:
tslm(formula = M1_ts ~ faiz_ts + enflasyon_ts + darphane_ts)

Residuals:
       Min         1Q     Median         3Q        Max 
-2.066e+09 -3.793e+08  6.262e+07  1.913e+08  2.470e+09 

Coefficients:
               Estimate Std. Error t value Pr(>|t|)    
(Intercept)  -606002904  127825722  -4.741 6.00e-06 ***
faiz_ts        14144476    4376990   3.232   0.0016 ** 
enflasyon_ts   26342318    5265606   5.003 1.99e-06 ***
darphane_ts    44715340    5483430   8.155 4.25e-13 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 664800000 on 118 degrees of freedom
Multiple R-squared:  0.746,	Adjusted R-squared:  0.7395 
F-statistic: 115.5 on 3 and 118 DF,  p-value: < 2.2e-16
Call:
tslm(formula = M1_ts ~ enflasyon_ts + darphane_ts)

Residuals:
       Min         1Q     Median         3Q        Max 
-2.502e+09 -2.761e+08 -3.878e+07  1.683e+08  2.571e+09 

Coefficients:
               Estimate Std. Error t value Pr(>|t|)    
(Intercept)  -374645564  110016673  -3.405 0.000902 ***
enflasyon_ts   37138442    4228456   8.783 1.41e-14 ***
darphane_ts    52701533    5085463  10.363  < 2e-16 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 690700000 on 119 degrees of freedom
Multiple R-squared:  0.7235,	Adjusted R-squared:  0.7189 
F-statistic: 155.7 on 2 and 119 DF,  p-value: < 2.2e-16

In our first model, I have obtained the null hypothesis that the we fail to reject the coefficient of altın_ts will be zero so in my second model, I have not added altın_ts as independent variable. As it can be seen from the resiual standard error results and adjusted R squared results, the model is somehow can be an explanation to the actual data. From the table provided below, It can bee seen that the performance metric results of all three models are close to each other. Obtaining adjusted R squared value close to 0.74 is good for the explanation of variability for our data. If we applied transformation techniques and obtained values, we would have obtained better results.

In [21]:
CV_data <- data.frame(rbind(CV(tslm_M1_1), CV(tslm_M1_2), CV(tslm_M1_3)))
CV_data
A data.frame: 3 × 5
CVAICAICcBICAdjR2
<dbl><dbl><dbl><dbl><dbl>
5.077549e+174962.8554963.5864979.6790.7414411
4.935865e+174962.7894963.3064976.8090.7395375
5.299412e+174971.1344971.4764982.3500.7188692

By making both dependent variable and independent variables stationary, eliminating outliers and applying moving average methods to smooth the data, the graph provided below would have been improved.

In [22]:
autoplot(M1_ts, series = "Actual Data") + 
  autolayer(fitted(tslm_M1_1), series = "Model Result")
In [23]:
checkresiduals(tslm_M1_1)
checkresiduals(tslm_M1_2)
checkresiduals(tslm_M1_3)
	Breusch-Godfrey test for serial correlation of order up to 24

data:  Residuals from Linear regression model
LM test = 91.051, df = 24, p-value = 9.651e-10
	Breusch-Godfrey test for serial correlation of order up to 24

data:  Residuals from Linear regression model
LM test = 87.525, df = 24, p-value = 3.688e-09
	Breusch-Godfrey test for serial correlation of order up to 24

data:  Residuals from Linear regression model
LM test = 80.951, df = 24, p-value = 4.289e-08

When we check the autocorrelation function of residuals it can be seen that there exists high autocorrelation for low lag values which indicates that there is a need for differencing. It can be seen that the residuals are likely to be around zero mean however there does not exist constant variance. This constant variance can be obtained by log transformation and box-cox transformation techniques since our independent variable and dependent variables are not even stationary. From the provided scatter plots below, it can be observed that for small money supply amounts the residuals did not scattered randomly and form a cluster however for higher values, they are distributed more randomly. This indicated that there still exists some variablity that could be captured by our model.

In [24]:
df_M1[,"Residuals"] <- as.numeric(residuals(tslm_M1_1))
ggplot(df_M1, aes(x = M1, y = Residuals)) + geom_point()
ggplot(df_M1, aes(x = fitted(tslm_M1_1), y = Residuals)) + geom_point()
Don't know how to automatically pick scale for object of type <ts>. Defaulting
to continuous.

Unemployment Rate Model:

It can be observed that our unemployment rate graph is cyclic.

In [25]:
autoplot(unemployment_rate_ts) + ggtitle("Unemployment Rate vs Time") + xlab("Year") + ylab("Unemployment Rate")

It can be observed that there exists high autocorrelation function values for small lag amounts which shows us that the need for an autoregressive model or making data stationary.

In [26]:
ggAcf(unemployment_rate_ts, lag.max = 120)
ggAcf(unemployment_rate_ts)
In [27]:
df_unemployment_rate <- cbind(unemployment_rate_data[,-1], iş_ilanları_data$Amount, enflasyon_data$Amount, işsizlik_sigortası_data$Amount, salgın_hastalık_data$Amount, işsizlik_data$Amount)
df_unemployment_rate
A data.frame: 122 × 6
Rateiş_ilanları_data$Amountenflasyon_data$Amountişsizlik_sigortası_data$Amountsalgın_hastalık_data$Amountişsizlik_data$Amount
<dbl><int><int><int><int><int>
10.545 914718
10.546 515322
9.440 413316
8.840 513418
8.439 512417
9.045 514319
9.744 512319
10.146 312517
10.151 314420
10.947 412418
10.452 415321
10.850 513221
11.952 916124
11.755 614322
10.451 612422
9.646 513220
8.944 713321
9.655 912323
10.052 713221
10.056 412221
10.353 410320
10.558 411321
10.253 613324
10.954 914324
11.5551317440
11.062 516238
10.158 512234
9.155 512332
9.055 512328
10.160 513329
⋮⋮⋮⋮⋮⋮
11.16417 52826
10.75725 6 625
10.95138 7 325
11.34856 7 635
12.15666 9 643
11.45938 7 539
11.45842 8 534
10.64853 7 534
10.15276 7 728
9.76074 7 534
10.65758 6 539
9.85936 8 336
9.95940 7 433
9.95740 7 431
9.95342 6 830
10.45154 91339
10.35641 81042
10.75524 61034
10.25624 8 634
10.0452610 631
8.84726 6 430
9.0493510 638
9.76047 7 638
9.25527 6 734
8.95735 71335
8.24929 61133
8.84738 6 831
8.94445 71636
9.84943 72942
9.7453010 938
In [28]:
require(GGally)
ggpairs(df_unemployment_rate)
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'iş_ilanları_data$Amount' in 'mbcsToSbcs': dot substituted for <c5>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'iş_ilanları_data$Amount' in 'mbcsToSbcs': dot substituted for <9f>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'iş_ilanları_data$Amount' in 'mbcsToSbcs': dot substituted for <c4>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'iş_ilanları_data$Amount' in 'mbcsToSbcs': dot substituted for <b1>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'işsizlik_sigortası_data$Amount' in 'mbcsToSbcs': dot substituted for <c5>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'işsizlik_sigortası_data$Amount' in 'mbcsToSbcs': dot substituted for <9f>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'işsizlik_sigortası_data$Amount' in 'mbcsToSbcs': dot substituted for <c4>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'işsizlik_sigortası_data$Amount' in 'mbcsToSbcs': dot substituted for <b1>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'salgın_hastalık_data$Amount' in 'mbcsToSbcs': dot substituted for <c4>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'salgın_hastalık_data$Amount' in 'mbcsToSbcs': dot substituted for <b1>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'salgın_hastalık_data$Amount' in 'mbcsToSbcs': dot substituted for <c4>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'salgın_hastalık_data$Amount' in 'mbcsToSbcs': dot substituted for <b1>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'işsizlik_data$Amount' in 'mbcsToSbcs': dot substituted for <c5>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'işsizlik_data$Amount' in 'mbcsToSbcs': dot substituted for <9f>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'iş_ilanları_data$Amount' in 'mbcsToSbcs': dot substituted for <c5>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'iş_ilanları_data$Amount' in 'mbcsToSbcs': dot substituted for <9f>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'iş_ilanları_data$Amount' in 'mbcsToSbcs': dot substituted for <c4>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'iş_ilanları_data$Amount' in 'mbcsToSbcs': dot substituted for <b1>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'işsizlik_sigortası_data$Amount' in 'mbcsToSbcs': dot substituted for <c5>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'işsizlik_sigortası_data$Amount' in 'mbcsToSbcs': dot substituted for <9f>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'işsizlik_sigortası_data$Amount' in 'mbcsToSbcs': dot substituted for <c4>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'işsizlik_sigortası_data$Amount' in 'mbcsToSbcs': dot substituted for <b1>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'salgın_hastalık_data$Amount' in 'mbcsToSbcs': dot substituted for <c4>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'salgın_hastalık_data$Amount' in 'mbcsToSbcs': dot substituted for <b1>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'salgın_hastalık_data$Amount' in 'mbcsToSbcs': dot substituted for <c4>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'salgın_hastalık_data$Amount' in 'mbcsToSbcs': dot substituted for <b1>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'işsizlik_data$Amount' in 'mbcsToSbcs': dot substituted for <c5>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'işsizlik_data$Amount' in 'mbcsToSbcs': dot substituted for <9f>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'iş_ilanları_data$Amount' in 'mbcsToSbcs': dot substituted for <c5>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'iş_ilanları_data$Amount' in 'mbcsToSbcs': dot substituted for <9f>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'iş_ilanları_data$Amount' in 'mbcsToSbcs': dot substituted for <c4>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'iş_ilanları_data$Amount' in 'mbcsToSbcs': dot substituted for <b1>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'işsizlik_sigortası_data$Amount' in 'mbcsToSbcs': dot substituted for <c5>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'işsizlik_sigortası_data$Amount' in 'mbcsToSbcs': dot substituted for <9f>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'işsizlik_sigortası_data$Amount' in 'mbcsToSbcs': dot substituted for <c4>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'işsizlik_sigortası_data$Amount' in 'mbcsToSbcs': dot substituted for <b1>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'salgın_hastalık_data$Amount' in 'mbcsToSbcs': dot substituted for <c4>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'salgın_hastalık_data$Amount' in 'mbcsToSbcs': dot substituted for <b1>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'salgın_hastalık_data$Amount' in 'mbcsToSbcs': dot substituted for <c4>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'salgın_hastalık_data$Amount' in 'mbcsToSbcs': dot substituted for <b1>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'işsizlik_data$Amount' in 'mbcsToSbcs': dot substituted for <c5>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'işsizlik_data$Amount' in 'mbcsToSbcs': dot substituted for <9f>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'iş_ilanları_data$Amount' in 'mbcsToSbcs': dot substituted for <c5>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'iş_ilanları_data$Amount' in 'mbcsToSbcs': dot substituted for <9f>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'iş_ilanları_data$Amount' in 'mbcsToSbcs': dot substituted for <c4>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'iş_ilanları_data$Amount' in 'mbcsToSbcs': dot substituted for <b1>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'işsizlik_sigortası_data$Amount' in 'mbcsToSbcs': dot substituted for <c5>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'işsizlik_sigortası_data$Amount' in 'mbcsToSbcs': dot substituted for <9f>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'işsizlik_sigortası_data$Amount' in 'mbcsToSbcs': dot substituted for <c4>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'işsizlik_sigortası_data$Amount' in 'mbcsToSbcs': dot substituted for <b1>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'salgın_hastalık_data$Amount' in 'mbcsToSbcs': dot substituted for <c4>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'salgın_hastalık_data$Amount' in 'mbcsToSbcs': dot substituted for <b1>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'salgın_hastalık_data$Amount' in 'mbcsToSbcs': dot substituted for <c4>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'salgın_hastalık_data$Amount' in 'mbcsToSbcs': dot substituted for <b1>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'işsizlik_data$Amount' in 'mbcsToSbcs': dot substituted for <c5>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'işsizlik_data$Amount' in 'mbcsToSbcs': dot substituted for <9f>”
Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'iş_ilanları_data$Amount' in 'mbcsToSbcs': dot substituted for <c5>”
Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'iş_ilanları_data$Amount' in 'mbcsToSbcs': dot substituted for <9f>”
Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'iş_ilanları_data$Amount' in 'mbcsToSbcs': dot substituted for <c4>”
Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'iş_ilanları_data$Amount' in 'mbcsToSbcs': dot substituted for <b1>”
Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'işsizlik_sigortası_data$Amount' in 'mbcsToSbcs': dot substituted for <c5>”
Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'işsizlik_sigortası_data$Amount' in 'mbcsToSbcs': dot substituted for <9f>”
Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'işsizlik_sigortası_data$Amount' in 'mbcsToSbcs': dot substituted for <c4>”
Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'işsizlik_sigortası_data$Amount' in 'mbcsToSbcs': dot substituted for <b1>”
Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'salgın_hastalık_data$Amount' in 'mbcsToSbcs': dot substituted for <c4>”
Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'salgın_hastalık_data$Amount' in 'mbcsToSbcs': dot substituted for <b1>”
Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'salgın_hastalık_data$Amount' in 'mbcsToSbcs': dot substituted for <c4>”
Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'salgın_hastalık_data$Amount' in 'mbcsToSbcs': dot substituted for <b1>”
Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'işsizlik_data$Amount' in 'mbcsToSbcs': dot substituted for <c5>”
Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'işsizlik_data$Amount' in 'mbcsToSbcs': dot substituted for <9f>”
Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'iş_ilanları_data$Amount' in 'mbcsToSbcs': dot substituted for <c5>”
Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'iş_ilanları_data$Amount' in 'mbcsToSbcs': dot substituted for <9f>”
Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'iş_ilanları_data$Amount' in 'mbcsToSbcs': dot substituted for <c4>”
Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'iş_ilanları_data$Amount' in 'mbcsToSbcs': dot substituted for <b1>”
Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'işsizlik_sigortası_data$Amount' in 'mbcsToSbcs': dot substituted for <c5>”
Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'işsizlik_sigortası_data$Amount' in 'mbcsToSbcs': dot substituted for <9f>”
Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'işsizlik_sigortası_data$Amount' in 'mbcsToSbcs': dot substituted for <c4>”
Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'işsizlik_sigortası_data$Amount' in 'mbcsToSbcs': dot substituted for <b1>”
Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'salgın_hastalık_data$Amount' in 'mbcsToSbcs': dot substituted for <c4>”
Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'salgın_hastalık_data$Amount' in 'mbcsToSbcs': dot substituted for <b1>”
Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'salgın_hastalık_data$Amount' in 'mbcsToSbcs': dot substituted for <c4>”
Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'salgın_hastalık_data$Amount' in 'mbcsToSbcs': dot substituted for <b1>”
Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'işsizlik_data$Amount' in 'mbcsToSbcs': dot substituted for <c5>”
Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
“conversion failure on 'işsizlik_data$Amount' in 'mbcsToSbcs': dot substituted for <9f>”
In [29]:
tslm_unemployment_rate_1 <- tslm(unemployment_rate_ts ~ iş_ilanları_ts + enflasyon_ts + salgın_hastalık_ts + işsizlik_sigortası_ts + işsizlik_ts)
tslm_unemployment_rate_2 <- tslm(unemployment_rate_ts ~ iş_ilanları_ts + enflasyon_ts + salgın_hastalık_ts + işsizlik_ts)
tslm_unemployment_rate_3 <- tslm(unemployment_rate_ts ~ iş_ilanları_ts + enflasyon_ts + işsizlik_ts)
summary(tslm_unemployment_rate_1)
summary(tslm_unemployment_rate_2)
summary(tslm_unemployment_rate_3)
Call:
tslm(formula = unemployment_rate_ts ~ iş_ilanları_ts + enflasyon_ts + 
    salgın_hastalık_ts + işsizlik_sigortası_ts + işsizlik_ts)

Residuals:
     Min       1Q   Median       3Q      Max 
-2.17093 -0.80596 -0.08229  0.68503  3.06319 

Coefficients:
                       Estimate Std. Error t value Pr(>|t|)    
(Intercept)            6.108889   0.667855   9.147 2.36e-15 ***
iş_ilanları_ts         0.063310   0.008408   7.530 1.20e-11 ***
enflasyon_ts          -0.017956   0.008110  -2.214 0.028784 *  
salgın_hastalık_ts     0.023155   0.011965   1.935 0.055392 .  
işsizlik_sigortası_ts -0.016515   0.041892  -0.394 0.694140    
işsizlik_ts            0.046211   0.013285   3.478 0.000711 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 1.124 on 116 degrees of freedom
Multiple R-squared:  0.5313,	Adjusted R-squared:  0.5111 
F-statistic:  26.3 on 5 and 116 DF,  p-value: < 2.2e-16
Call:
tslm(formula = unemployment_rate_ts ~ iş_ilanları_ts + enflasyon_ts + 
    salgın_hastalık_ts + işsizlik_ts)

Residuals:
    Min      1Q  Median      3Q     Max 
-2.1160 -0.8259 -0.1021  0.6669  3.1330 

Coefficients:
                    Estimate Std. Error t value Pr(>|t|)    
(Intercept)         5.936762   0.503535  11.790  < 2e-16 ***
iş_ilanları_ts      0.063780   0.008293   7.691 5.04e-12 ***
enflasyon_ts       -0.016136   0.006644  -2.429 0.016678 *  
salgın_hastalık_ts  0.023802   0.011809   2.016 0.046132 *  
işsizlik_ts         0.044248   0.012273   3.605 0.000459 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 1.12 on 117 degrees of freedom
Multiple R-squared:  0.5307,	Adjusted R-squared:  0.5147 
F-statistic: 33.08 on 4 and 117 DF,  p-value: < 2.2e-16
Call:
tslm(formula = unemployment_rate_ts ~ iş_ilanları_ts + enflasyon_ts + 
    işsizlik_ts)

Residuals:
    Min      1Q  Median      3Q     Max 
-2.0833 -0.8053 -0.0648  0.5990  3.1677 

Coefficients:
                Estimate Std. Error t value Pr(>|t|)    
(Intercept)     6.042571   0.507249  11.912  < 2e-16 ***
iş_ilanları_ts  0.057940   0.007871   7.361 2.66e-11 ***
enflasyon_ts   -0.018134   0.006655  -2.725  0.00741 ** 
işsizlik_ts     0.058272   0.010241   5.690 9.40e-08 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 1.134 on 118 degrees of freedom
Multiple R-squared:  0.5144,	Adjusted R-squared:  0.5021 
F-statistic: 41.67 on 3 and 118 DF,  p-value: < 2.2e-16

I have subtracted işsizlik sigortası time series from my model since it had too large p value and I created a new model and obtained better results as it can be seen from the table provided below. From the table below, it can be seen that the model that yields best results is the second model so I will be proceeding with it.

In [30]:
CV_data <- data.frame(rbind(CV(tslm_unemployment_rate_1), CV(tslm_unemployment_rate_2), CV(tslm_unemployment_rate_3)))
CV_data
A data.frame: 3 × 5
CVAICAICcBICAdjR2
<dbl><dbl><dbl><dbl><dbl>
1.42938736.2980137.2804655.926160.5111465
1.38364534.4613535.1917851.285480.5146754
1.31068036.6257637.1430050.645870.5020789

From the actual data vs model result plot provided below, it can be seen that our model captures some information from actual data and creates well enough model result.

In [31]:
autoplot(unemployment_rate_ts, series = "Actual Data") + 
  autolayer(fitted(tslm_unemployment_rate_2), series = "Model Result")
In [32]:
checkresiduals(tslm_unemployment_rate_1)
checkresiduals(tslm_unemployment_rate_2)
checkresiduals(tslm_unemployment_rate_3)
	Breusch-Godfrey test for serial correlation of order up to 24

data:  Residuals from Linear regression model
LM test = 86.587, df = 24, p-value = 5.253e-09
	Breusch-Godfrey test for serial correlation of order up to 24

data:  Residuals from Linear regression model
LM test = 86.204, df = 24, p-value = 6.069e-09
	Breusch-Godfrey test for serial correlation of order up to 24

data:  Residuals from Linear regression model
LM test = 86.535, df = 24, p-value = 5.358e-09

Since the Breusch-Godfrey test results are strictly low, we reject that there exists no autocorrelation for residuals or we obtained good heterodasticity. It can be seen that residuals do not have constant variance, which indicated that our data was not stationary as I have mentioned. And there is a downward regular decreasing trend in autocorrelation function plot, which indicates the need for making the data stationary. However the distribution of residuals provided below is not that biased which would show the need for explanation of heterodasticity but not the model as a whole.

In [33]:
df_unemployment_rate[,"Residuals"] <- as.numeric(residuals(tslm_unemployment_rate_2))
ggplot(df_M1, aes(x = fitted(tslm_unemployment_rate_2), y = Residuals)) + geom_point()
Don't know how to automatically pick scale for object of type <ts>. Defaulting
to continuous.

Conclusion:

To conclude, some of the Google Trends data were able to explain the patterns and behaviours of relevant TCMB data and some were not. I have obtained different metric values and performance measures for different models. The data for our dependent variables showed an increasing trend in each of the three models we constructed. This suggests that there is non-stationarity in our time series data. But stationary time series data is required for time series regression models to meet the assumptions and produce accurate forecasts. We were unable to make our data stationary for this project. Consequently, we were incapable of come up with a reliable time series regression model, as seen by our scatter plots and test outcomes. We will need to use transformation and differencing techniques to our independent and dependent datasets in order to fix this problem. Furthermore, additional thorough analyses will be needed. Even though there was some correlation and explanatory power between the dependent and selected independent variables, we were unable to create a solid prediction model due to the absence of proper, stationary datasets. Going forward, more work will be focused on turning the data into a stationary form so that we can create reliable time series regression models that can produce reliable forecasts.